﻿using System;
using System.Web.UI;

namespace AB.ServiceDirectory.Design.WebUserControls
{
    public partial class DialogBox : UserControl
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            DisplayAllPanel(false);
        }

        /// <summary>
        /// Warnings the specified text.
        /// </summary>
        /// <param name="text">The text.</param>
        public void Warning(string text)
        {
            DisplayAllPanel(false);
            LiteralWarning.Text = text;
            PanelWarning.Visible = true;
        }

        /// <summary>
        /// Successes the specified text.
        /// </summary>
        /// <param name="text">The text.</param>
        public void Success(string text)
        {
            DisplayAllPanel(false);
            LiteralSuccess.Text = text;
            PanelSuccess.Visible = true;
        }

        /// <summary>
        /// Informations the specified text.
        /// </summary>
        /// <param name="text">The text.</param>
        public void Information(string text)
        {
            DisplayAllPanel(false);
            LiteralInformation.Text = text;
            PanelInformation.Visible = true;
        }

        /// <summary>
        /// Errors the specified text.
        /// </summary>
        /// <param name="text">The text.</param>
        public new void Error(string text)
        {
            DisplayAllPanel(false);
            LiteralError.Text = text;
            PanelError.Visible = true;
        }

        /// <summary>
        /// Displays all panel.
        /// </summary>
        /// <param name="status">if set to <c>true</c> [status].</param>
        public void DisplayAllPanel(bool status)
        {
            PanelError.Visible = status;
            PanelInformation.Visible = status;
            PanelSuccess.Visible = status;
            PanelWarning.Visible = status;
        }
    }
}